<?php

function micro_time()
{
   list($usec, $sec) = explode(" ", microtime());
   return ($usec * 1000000 + $sec * 1000000);
}

$starttime = micro_time();
$ch = curl_init();

$url = "http://www.baidu.com?a=a";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, "0");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
   'name' => 'cxy',
]);

$output = curl_exec($ch);
$info = curl_getinfo($ch);
// print_r($info);
curl_close($ch);
$endtime = micro_time();
var_dump("时间差:" . ($endtime - $starttime));